//
//  MineLuckController.swift
//  HappyEat
//
//  Created by ctx2016 on 17/1/16.
//  Copyright © 2017年 陌路是我. All rights reserved.
//

import UIKit

class MineLuckController: UIViewController ,UITableViewDelegate,UITableViewDataSource{
    
    var tableView:UITableView = UITableView.init()
    
    let CellId:String = "CELLID"

    override func viewDidLoad() {
        super.viewDidLoad()
        self.setUI()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.setNav()
    }
}
extension MineLuckController{
    func setNav(){
        self.navigationItem.title = "幸运记录"
        self.navigationController?.navigationBar.barTintColor = .red
        self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(title: "", imagStr: "ic_back", fontSize: 14, target: self, action: #selector(leftButtonAction))
    }
    func leftButtonAction(){
        self.navigationController!.popViewController(animated: true)
    }
    func setUI(){
        self.view.addSubview(self.tableView)
        self.tableView.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(0)
            make.bottom.equalTo(0)
        }
        self.tableView.delegate = self
        self.tableView.dataSource = self
        self.tableView.register(MineDingDanCell.self, forCellReuseIdentifier: CellId)
        self.tableView.tableFooterView = UIView.init()
    }
    @objc(numberOfSectionsInTableView:) func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    @objc(tableView:cellForRowAtIndexPath:) func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell:MineDingDanCell = tableView.dequeueReusableCell(withIdentifier: CellId) as! MineDingDanCell
        cell.dingdanTYpe = .luckRecoderType
        cell.nameLabel.text = "芝士蛋糕"
        cell.qhLabel.text = "312145"
        cell.joinLabel.text = "1人次"
        cell.winerLabel.text = "幸运号码:231313"
        cell.dateLabel.text = "揭晓日期:2017-12-24"
        cell.dataDic = ["":""]
        return cell
    }
    @objc(tableView:heightForRowAtIndexPath:) func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 24+28+16+96
    }
}
